package com.sskj.community.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.community.ui.fragment.PublishFragment;
import com.sskj.lib.bean.HotBean;
import com.sskj.lib.bean.NoticeBean;
import com.sskj.lib.http.JsonCallBack;


/**
 * @author Hey
 * Create at  2019/06/25
 */
public class PublishPresenter extends BasePresenter<PublishFragment> {

    public void getPublishData(boolean showLoading,int p, String size) {
        httpService.getNoticeList(p,size)
                .tag(this)
                .execute(new JsonCallBack<HttpData<NoticeBean>>(showLoading?this:null) {
                    @Override
                    public void onSuccess(Response<HttpData<NoticeBean>> response) {
                        HttpData<NoticeBean> body = response.body();
                        NoticeBean data = body.getData();
                        mView.getNoticeListSuccess(data);
                    }

                    @Override
                    public void onFinish() {
                        super.onFinish();
                        mView.stopRefresh();
                    }
                });
    }
}
